#ifndef ALGORITHM_H
#define ALGORITHM_H
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <limits.h>
#include <iostream>
#include <QString>
#include <QList>
#include <QPoint>
#include <qmath.h>
#include <general.h>
#include "analytedatabase.h"//

#include <stdio.h>
#include <stdlib.h>
#include "math.h"

using namespace std;//

class Algorithm
{
public:
    Algorithm();

    static QList<double> GetNumList(int num,double startData,double d);//构造数列
    static QList<double> GetNumList(int num);//构造数列

    static double SdData(QList<double> datas);//计算标准差
    static double RsdData(QList<double> datas);
    static double MeanData(QList<double> datas);//计算平均值
    static QList<double> FilterMean(QList<double> datas);//滤波（溶解曲线）

    //random
    static void InitRand();
    static double Rand(double min,double max);
    //序列参数
    static QList<ScanPara> GetHopScanPara(QHash<QString,HopScanPara>);
    static QList<ScanPara> GetSweepScanPara(QList<SweepScanPara>);
    static QList<ScanPara> GetSweepScanPara(QHash<QString,SweepScanPara>);
    //合并
    static bool MergeSweepScanPara(QList<QPair<double,double> >,QList<SweepScanPara> &paras,int index);
    //check

    static bool Max(QList<double> xs,double &max,int &index);
    static double CalResolution(QList<double> xs,QList<double> ys);

    static QList<SweepScanPara> CalSweepPara(QList<QPair<double,double> >,QList<SweepScanPara>);//合并

    //曲线拟合
    static void PolyFit(QList<double> w,QList<double> x, QList<double> y, QList<double> &p);
    static void GaussSolve(QList<double> A,QList<double> &x,QList<double> b);
    static double Func(double x);
    static void SetRatios(QList<double> );
    static QList<double> ratios;
};

#endif // ALGORITHM_H
